package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author liyang
 * @version 1.0
 * @package io
 * @file OISDemo.java
 * @description
 * @time 2024-03-28 16:10
 */
public class OISDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileInputStream fis = new FileInputStream("person.obj");
        ObjectInputStream ois = new ObjectInputStream(fis);
        /*obj.readObject();如果确定是由person类接收，则可以写成如下：*/
        Person person = (Person)ois.readObject();
        System.out.println(person);
        ois.close();
    }
}
